private {
	import derelict.opengl.gl;
}

public {
	import wglext;
}


version (Windows) {
	private import derelict.opengl.wgl;
	void* wglLoadExt(char[] name) { assert (wglGetProcAddress !is null); return wglGetProcAddress(name); }
}
version (linux) {
	static assert (false);
}



void loadAllWGLExtensions()
{
	wglCreateBufferRegionARB = cast(pfwglCreateBufferRegionARB)wglLoadExt("wglCreateBufferRegionARB");
	wglDeleteBufferRegionARB = cast(pfwglDeleteBufferRegionARB)wglLoadExt("wglDeleteBufferRegionARB");
	wglSaveBufferRegionARB = cast(pfwglSaveBufferRegionARB)wglLoadExt("wglSaveBufferRegionARB");
	wglRestoreBufferRegionARB = cast(pfwglRestoreBufferRegionARB)wglLoadExt("wglRestoreBufferRegionARB");
	wglGetExtensionsStringARB = cast(pfwglGetExtensionsStringARB)wglLoadExt("wglGetExtensionsStringARB");
	wglGetPixelFormatAttribivARB = cast(pfwglGetPixelFormatAttribivARB)wglLoadExt("wglGetPixelFormatAttribivARB");
	wglGetPixelFormatAttribfvARB = cast(pfwglGetPixelFormatAttribfvARB)wglLoadExt("wglGetPixelFormatAttribfvARB");
	wglChoosePixelFormatARB = cast(pfwglChoosePixelFormatARB)wglLoadExt("wglChoosePixelFormatARB");
	wglMakeContextCurrentARB = cast(pfwglMakeContextCurrentARB)wglLoadExt("wglMakeContextCurrentARB");
	wglGetCurrentReadDCARB = cast(pfwglGetCurrentReadDCARB)wglLoadExt("wglGetCurrentReadDCARB");
	wglCreatePbufferARB = cast(pfwglCreatePbufferARB)wglLoadExt("wglCreatePbufferARB");
	wglGetPbufferDCARB = cast(pfwglGetPbufferDCARB)wglLoadExt("wglGetPbufferDCARB");
	wglReleasePbufferDCARB = cast(pfwglReleasePbufferDCARB)wglLoadExt("wglReleasePbufferDCARB");
	wglDestroyPbufferARB = cast(pfwglDestroyPbufferARB)wglLoadExt("wglDestroyPbufferARB");
	wglQueryPbufferARB = cast(pfwglQueryPbufferARB)wglLoadExt("wglQueryPbufferARB");
	wglCreateDisplayColorTableEXT = cast(pfwglCreateDisplayColorTableEXT)wglLoadExt("wglCreateDisplayColorTableEXT");
	wglLoadDisplayColorTableEXT = cast(pfwglLoadDisplayColorTableEXT)wglLoadExt("wglLoadDisplayColorTableEXT");
	wglBindDisplayColorTableEXT = cast(pfwglBindDisplayColorTableEXT)wglLoadExt("wglBindDisplayColorTableEXT");
	wglDestroyDisplayColorTableEXT = cast(pfwglDestroyDisplayColorTableEXT)wglLoadExt("wglDestroyDisplayColorTableEXT");
	wglGetExtensionsStringEXT = cast(pfwglGetExtensionsStringEXT)wglLoadExt("wglGetExtensionsStringEXT");
	wglMakeContextCurrentEXT = cast(pfwglMakeContextCurrentEXT)wglLoadExt("wglMakeContextCurrentEXT");
	wglGetCurrentReadDCEXT = cast(pfwglGetCurrentReadDCEXT)wglLoadExt("wglGetCurrentReadDCEXT");
	wglCreatePbufferEXT = cast(pfwglCreatePbufferEXT)wglLoadExt("wglCreatePbufferEXT");
	wglGetPbufferDCEXT = cast(pfwglGetPbufferDCEXT)wglLoadExt("wglGetPbufferDCEXT");
	wglReleasePbufferDCEXT = cast(pfwglReleasePbufferDCEXT)wglLoadExt("wglReleasePbufferDCEXT");
	wglDestroyPbufferEXT = cast(pfwglDestroyPbufferEXT)wglLoadExt("wglDestroyPbufferEXT");
	wglQueryPbufferEXT = cast(pfwglQueryPbufferEXT)wglLoadExt("wglQueryPbufferEXT");
	wglGetPixelFormatAttribivEXT = cast(pfwglGetPixelFormatAttribivEXT)wglLoadExt("wglGetPixelFormatAttribivEXT");
	wglGetPixelFormatAttribfvEXT = cast(pfwglGetPixelFormatAttribfvEXT)wglLoadExt("wglGetPixelFormatAttribfvEXT");
	wglChoosePixelFormatEXT = cast(pfwglChoosePixelFormatEXT)wglLoadExt("wglChoosePixelFormatEXT");
	wglSwapIntervalEXT = cast(pfwglSwapIntervalEXT)wglLoadExt("wglSwapIntervalEXT");
	wglGetSwapIntervalEXT = cast(pfwglGetSwapIntervalEXT)wglLoadExt("wglGetSwapIntervalEXT");
	wglBindTexImageARB = cast(pfwglBindTexImageARB)wglLoadExt("wglBindTexImageARB");
	wglReleaseTexImageARB = cast(pfwglReleaseTexImageARB)wglLoadExt("wglReleaseTexImageARB");
	wglSetPbufferAttribARB = cast(pfwglSetPbufferAttribARB)wglLoadExt("wglSetPbufferAttribARB");
}
